<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //1.单个参数可以省略圆括号
    const add=x=>{
      return x+1
    }
    console.log(add(1));
    //无参数或多个参数不能省略圆括号哦
    const a=()=>{
      return 1
    }
    console.log(a());
    //单行函数体可以同时省略{}和return
    const b=(x,y)=>x+y
    console.log(b(1,1));
    //多行函数体不能再简化了
    const c=(x,y)=>{
      let sum=x+y
      return sum
    }
    console.log(c(1,2));
    //如果箭头函数返回单行对象，可以在{}外面加上()让浏览器不再认为那是函数体的花括号
    const d=(x,y)=>({value:x+y})
    console.log(d(1,2));
  </script>
</body>
</html>